<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue.js"></script>
  <style>
    .card {
      width: 500px;
      height: 350px;
      border: 1px solid #ccc;
      border-radius: 5px;
      padding: 10px;
      margin: 20px;
    }

    .header {
      display: flex;
      height: 50px;
    }

    .title {
      height: 50px;
      line-height: 50px;
      width: 300px;
      background-color: lightgreen;
    }

    .title>div {
      text-align: center;
      font-size: 20px;
      font-weight: bold;
    }

    .options {
      width: 200px;
      height: 50px;
      line-height: 50px;
      background-color: lightpink;
      text-align: center;
    }
  </style>
</head>

<body>
  <div id="app">
    <my-card :title="title" :options="optionsArr">
      <template #content>
        <div style="background-color: lightseagreen;width: 100%;height: 290px;">
          我是内容区间内容
        </div>
      </template>
    </my-card>
  </div>
  <script>
    let card = {
      props: {
        title: {
          type: String,
          required: true
        },
        options: {
          type: Array,
          default() {
            return []
          }
        }
      },
      data() {
        return {

        }
      },
      template: `
        <div class="card">
          <div class="header">
            <div class="title">
              <div>{{title}}</div>
            </div>
            <div class="options">
              <div class="btns" v-if="options.length>0">
                <button v-for="(item, index) in options" :key="index">{{item}}</button>
              </div>
            </div>
          </div>
          <div class="content">
            <slot name="content"></slot>
          </div>
        </div>
      `,
      methods: {

      },
      created() {

      }
    }
    let vm = new Vue({
      el: "#app",
      data: {
        title: '图书馆人流量',
        optionsArr: ['年', '月', '日']
      },
      methods: {

      },
      created() {

      },
      components: {
        myCard: card
      }
    })
  </script>
</body>

</html>